import 'package:flutter/material.dart';
import 'package:flutter_09_game/config/app_color.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class WidgetProfileItem extends StatelessWidget {
  const WidgetProfileItem(this.title, this.child,
      {super.key, this.leftStr, this.rightWidget});

  final String title;
  final Widget child;

  final String? leftStr;
  final Widget? rightWidget;

  @override
  Widget build(BuildContext context) {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        SizedBox(
            height: 40.w,
            child: Row(
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                RichText(
                  text: TextSpan(
                    text: title,
                    style: TextStyle(
                      color: AppColor.textPrimary.withOpacity(0.94),
                      fontSize: 16.sp,
                      fontWeight: FontWeight.w600,
                    ),
                    children: [
                      if ((leftStr ?? '').isNotEmpty)
                        TextSpan(
                          text: leftStr ?? '',
                          style: TextStyle(
                            color: AppColor.primary,
                            fontSize: 16.sp,
                            fontWeight: FontWeight.w600,
                          ),
                        ),
                    ],
                  ),
                ),
                const Spacer(),
                if (rightWidget != null) rightWidget!
              ],
            )),
        4.verticalSpaceFromWidth,
        child
      ],
    );
  }
}
